'''
自动管理cookie：
    requests、get、post，这种方式不会管理cookie
    session的机制，创建一个session，用session发送请求，这种情况下会自动管理cookie
'''

import requests

s = requests.Session()  # 创建一个session]]
print("登陆前：", s.cookies)
url = "https://www.bagevent.com/user/login"
cs = {
    "access_type": "1",
    "loginType": "1",
    "emailLoginWay": "0",
    "account": "2780487875@qq.com",
    "password": "qq2780487875",
    "remindmeBox": "on",
    "remindme": "1"
}
r = s.post(url, data=cs)
# print(r.text)


print("==========================登陆后========================")
print("登陆后：", s.cookies)

url = "https://www.bagevent.com/account/dashboard"
r = s.get(url)
# s.post()
# print(r.text)


url = "https://www.bagevent.com//user/login_out"
r = s.get(url)
print("退出登陆后：", s.cookies)
